/**
 * Created by hcadmin on 16/4/25.
 */
define([
    "jquery",
    "IO",
    "jqueryUI",
    "bootbox"
], function($,IO,bootbox) {
    $(function () {
        var grid;
        //每列数据列性
        var columns = [
            {
                title: '医生ID',
                dataIndex: 'doctor_id',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].doctor_id + "</span>";
                }
            },
            {
                title: '医院姓名',
                dataIndex: 'realname',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].realname + "</span>";
                }
            },
            {
                title: '结算事项',
                dataIndex: 'create_date',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].month +"月结算"+ "</span>";
                }
            },
            {
                title: '银行卡号',
                dataIndex: 'card_num',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].card_num + "</span>";
                }
            },
            {
                title: '结算余额',
                dataIndex: 'remain_asset',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].remain_asset + "</span>";
                }
            },
            {
                title: '结算时间',
                dataIndex: 'settlement_date',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>" + data[datarow].settlement_date + "</span>";
                }
            },
            {
                title: '状态',
                dataIndex: 'vocabulary_like',
                dataSource: function (data, datarow, gridobj, current_column) {
                    return "<span>已结算</span>";
                }
            },

        ];


        //数组初始化

        function dataInit() {
            var month = $("#category1 option:selected").attr("data-id");
            //console.log("yuefen",month)
            grid = new Grid("/api/settlementLog/list/finish?month="+month, $("#table_my_toast"), $("#paging_my_toast"), 1, 10, columns, get_input_param(), 10);

            //初始化
            grid.Init();
        }

        //获取输入框内容
        function get_input_param() {

        }

        dataInit();

        //查询
        $("#search").bind("click", function () {
            dataInit();
        });

    });

    //导出已结算账单
    $("#consult").bind("click", function () {
        $("#bill").modal();
    });

    //确认导出已结算账单
    $("#commitExport").bind("click", function () {
        var month = $("#category1 option:selected").attr("data-id");
        if (isNaN(month))
            month = '';
        var url = this.value + "?month=" + month;
        self.location = url;
    });

})